##go 语言支持
INCLUDE(${CMAKE_MODULE_PATH}/golang.cmake)
INCLUDE(${CMAKE_MODULE_PATH}/flags.cmake)# if use CGO


### 设置通用配置
SET(CMAKE_VERBOSE_MAKEFILE ON)
SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
##windows时需要此判断 
#IF(CMAKE_CL_64)
#    set(platform x64)
#ELSE(CMAKE_CL_64)
#   set(platform x86)
#ENDIF(CMAKE_CL_64)

IF (WIN32)
	set(sys win)
    set(DEF_GOOS windows)
ELSE ()
	set(sys linux)
    set(DEF_GOOS linux)
ENDIF()
MESSAGE(STATUS "System[${sys}]")
#IF (WIN32)
#	SET(THIRDLIB_PATH ${PROJECT_SOURCE_DIR}/thirdlib/win)
#ELSE()
#	SET(THIRDLIB_PATH ${PROJECT_SOURCE_DIR}/thirdlib/unix)
#ENDIF(WIN32)

# GOOS [darwin|freebsd|linux|windows]
SET(GOOS ${DEF_GOOS} CACHE STRING "GOOS [darwin|freebsd|linux|windows]")    
# GOARCH [386|amd64|arm]
SET(GOARCH amd64 CACHE STRING "GOARCH [386|amd64|arm]") 
SET(CGO_ENABLED  0 CACHE STRING "CGO_ENABLED [默认为0]")

MESSAGE(STATUS "GO BUILD OPTION GOOS[${GOOS}] GOARCH[${GOARCH}] CGO_ENABLED[${CGO_ENABLED}]")

#if(NOT DEFINED ENV{JAVA_HOME})

### 设置公共目录 
SET(VA_COMMON ${PROJECT_SOURCE_DIR}/../../Common)
#SET(VA_COMMON /work/GIT/videoanalysis/Common)
#SET(PROTO_BASE ${VA_COMMON}/SourceCode/protobuf3)
SET(PROTO_BASE $ENV{GOPATH}/)
#SET(GRPC_BASE ${VA_COMMON}/SourceCode/gRPC)
#SET(PRI_GOPATH ${PROJECT_SOURCE_DIR}/gopath)
### 设置公共编译参数
#SET(CXX_FLAGS ${CMAKE_CXX_FLAGS} -m64 -g -Wall -fPIC -g -Werror)
#SET(CXX_FLAGS ${CMAKE_CXX_FLAGS} -std=c++11 )
#string(REPLACE ";" " " CMAKE_CXX_FLAGS "${CXX_FLAGS}")
#移到inc_common.cmake中
#MESSAGE(STATUS "CMAKE_CXX_FLAGS[${CMAKE_CXX_FLAGS}]")
#SET(CMAKE_BINARY_DIR ${PROJECT_SOURCE_DIR}/../out)
#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
#set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
#set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

SET(CMAKE_INSTALL_PREFIX /opt/hms)
SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
SET(CMAKE_INSTALL_RPATH "$ORIGIN")

###读取版本文件
#file(STRINGS   ${PROJECT_SOURCE_DIR}/version VER)
## 加载获取版本号以及输出版本文件 的函数，可在后续使用函数
#INCLUDE(${CMAKE_MODULE_PATH}/vVersion.cmake)

###
#set(CMAKE_SKIP_BUILD_RPATH FALSE)                 # 编译时加上RPATH  
#set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)         # 编译时RPATH不使用安装的RPATH  
#set(CMAKE_INSTALL_RPATH "")                       # 安装RPATH为空  
#set(CMAKE_INSTALL_RPATH_USE_LINK_PATH FALSE)      # 安装的执行文件不加上RPATH 
#SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) 
#SET(CMAKE_INSTALL_RPATH "\${ORIGIN}/../lib")




